package com.ltxtiyu.video;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
@ImportResource(locations = {"classpath:spring-mvc.xml"})
public class LtxMsApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(LtxMsApplication.class, args);
	}
    /**
     * 文件上传配置
     * @return
     */
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //单个文件最大
        factory.setMaxFileSize("1024000MB"); //KB,MB
        /// 设置总上传数据总大小
        factory.setMaxRequestSize("1024000MB");
        factory.setLocation("");
        return factory.createMultipartConfig();
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(LtxMsApplication.class);
    }
}
